<%--
  Created by IntelliJ IDEA.
  User: weig
  Date: 8/23/16
  Time: 4:02 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
</div>

<!-- jQuery 2.2.3 -->
<script src="/js/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/js/app.min.js"></script>
<!-- dataTable -->
<script src="/js/jquery.dataTables.min.js"></script>
<!-- sweetAlert -->
<script src="/js/sweetalert.min.js"></script>
<!-- datePicker -->
<script src="/js/bootstrap-datepicker.js"></script>

<script src="/js/dataTables.bootstrap.min.js"></script>
<script src="/js/siemens.js"></script>
</body>
</html>
<script>
    $(document).ajaxError(function( event, jqxhr, settings, thrownError ) {
        if (jqxhr.status == 401 || jqxhr.status == 403)
            window.location.reload();
    });

    $(document).ready(function(){
        var hash = window.location.hash;
        $('li a[data-hash="'+hash+'"]').parent().addClass('active') .parentsUntil('li.treeview').parent().addClass('active');
    });
    $(document).ready(function(){
        var key = '${sessionScope['siemens.multitenant.login.user'].getTenant()}';
        console.log(key);
        if(key!==""){
            $.ajax({
                type: "get",
                url: "/partner/{tenant}/api/v1/user/oneByKey".replace("{tenant}", key),
                success: function (data) {
                  if (data.data==null||data.data==""){
                      var img = $("<img/>").addClass("logo-lg").attr("src","").attr("style","height:50px;width:230px;");
                      $(".logo-lg-container").append(img)
                  }else{
                      var $img = $("<img/>").addClass("logo-lg").attr("src","/api/v1/image/get?name="+data.data).attr("style","height:50px;width:230px;");
                      $(".logo-lg-container").append($img)
                  }
                },
                error: function (e) {
                    console.log(e);
                }
            });
//        }else {
//            $.ajax({
//                url:"/admin/api/v1/messageCount",
//                type:"get",
//                success:function(data){
//                    $("#messageCount").text(data.data);
//                    $("#leftMessage").text(data.data);
//                },
//                error:function(e){
//                    console.log(e);
//                }
//            })
        }
    })
</script>